﻿using System;
using System.Activities;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WFExtended.Twitter.Activities.Designers;

namespace WFExtended.Twitter.Activities
{
    /// <summary>
    /// Returns the relationships of the authenticating user to the comma-separated list of up to 100 screen_names or user_ids provided. 
    /// </summary>
    [ToolboxBitmapAttribute(typeof(EntryPoint), "Resources.RelationshipToolbox.bmp")]
    [Designer(typeof(RelationshipDesigner))]
    [Description("Returns the relationships of the authenticating user to the comma-separated list of up to 100 screen_names or user_ids provided.")]
    public class FriendshipsLookup : TwitterOperationInvoker<List<WFExtended.Twitter.FriendshipsLookup>>
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="FriendshipsLookup"/> class.
        /// </summary>
        public FriendshipsLookup()
            : base("FriendshipsLookup")
        { }


        /// <summary>
        /// A comma separated list of screen names, up to 100 are allowed in a single request.
        /// <remarks>
        /// Required Argument
        /// </remarks>
        /// </summary>
        /// <value>
        /// The username.
        /// </value>
        [Browsable(true)]
        [Category("Properties")]
        [RequiredArgument]
        [Description("A comma separated list of screen names, up to 100 are allowed in a single request.")]
        public InArgument<string> Usernames { get; set; }

        /// <summary>
        /// Caches the metadata.
        /// </summary>
        /// <param name="metadata">The metadata.</param>
        protected override void CacheMetadata(System.Activities.NativeActivityMetadata metadata)
        {
            RuntimeArgument usernamesArgument = new RuntimeArgument("Usernames", typeof(string), ArgumentDirection.In, true);
            metadata.Bind(Usernames, usernamesArgument);
            metadata.AddArgument(usernamesArgument);

            base.CacheMetadata(metadata);
        }

        /// <summary>
        /// Executes the specified context.
        /// </summary>
        /// <param name="context">The context.</param>
        protected override void Execute(System.Activities.NativeActivityContext context)
        {
            Parameters.Clear();

            Parameters.Add("usernames", Usernames);

            base.Execute(context);
        }
    }
}
